package mobile.game.core.support.tuple;

import java.io.IOException;

import mobile.game.core.InputStream;
import mobile.game.core.OutputStream;
import mobile.game.core.interfaces.ISerilizable;

/**
 * @author g
 *
 * 4元组
 * @param <A>
 * @param <B>
 * @param <C>
 * @param <D>
 */
public class FourTuple<A, B, C, D> extends ThreeTuple<A, B, C> {
	public final D fourth;

	public FourTuple(A first, B second, C third, D fourth) {
		super(first, second, third);
		this.fourth = fourth;
	}

	@Override
	public void writeTo(OutputStream out) throws IOException {
		super.writeTo(out);
		out.write(fourth);
	}

	@Override
	public void readFrom(InputStream in) throws IOException {

	}

	public static ISerilizable create(InputStream in) throws IOException {
		return new FourTuple<>(in.read(), in.read(), in.read(), in.read());
	}

	public D getFourth() {
		return fourth;
	}
	
}
